<?php
/**
 +----------------------------------------------<br/>
 * 所有控制器的父类<br/>
 +----------------------------------------------
 * @category betterlife
 * @package  web.front
 * @author jason.tan
 */
class Action extends ActionBasic
{

	/**
	 * 在Action所有的方法执行之前可以执行的方法
	 */
	public function beforeAction()
	{
		$userid = HttpSession::get("userid");
		$left = false;
		if($userid){
			$member = UtilApi::get_store($userid);
			$this->view->set("member",$member->data);
			//查询会员信息
			$user_id = HttpSession::get("user_id");
			$result = UtilApi::getMember($user_id);
            if($result->code == "A00006"){
            	$data = $result->data;
                if (isset($data->user_gender)) {
					if($data->user_gender==1){
						$data->sex ="男";	
					}else{
						$data->sex ="女";
					}
				}elseif(isset($data->gender)) {
					if($data->gender==1){
						$data->sex ="男";	
					}else{
						$data->sex ="女";
					}
				}
				$left = true;
				$this->view->set("data",$data);
				//优惠券
				$array['user_mobile'] = $data->user_mobile;
		        $array['status'] = 1;
		        $array['inv_type'] = "";
		        $result = UtilApi::buy_coupon($array);
		        if ($result->code == "A00006") {
		            $coupon = $result->data;
		        }else{
		            $coupon = array();
		        }
		        $this->view->set("coupondata",$coupon);

            }
			
		}
		$this->view->set("left",$left);
	}

	/**
	 * 在Action所有的方法执行之后可以执行的方法
	 */
	public function afterAction()
	{
		parent::afterAction();
	}

}

?>